%% Thomas Stevens - Lim Lab 
%opened 12/25/12

%toy models for testing radial profiles, spatial autocorrelation
%--note: mark chan (marshall lab) uses radial profiles from centroid to fit spheres to
%vacuole data



function accum = checker(w,d,n)
%generate binary checkerboard (unit cell of width w in dimension d, n repeats)

if numel(w)==1
    flat = checkerboard(w,n,n)<.5;
else
    flat = 2*w-1; %scale to -1 +1
    w = length(w);
    flat = repmat(flat,1,n);
    flat = flat'*flat<1; %rescale to binary
end
accum=[];
if d==3
    for i=1:n+1
        accum = cat(3,accum,repmat(flat,[1 1 w]));
        flat=~flat;
    end
else
    accum=flat;
end
accum = logical(accum);
end

